﻿using FantomNext.Helpers;
using FantomNext.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FantomNext.Factories
{

    /// <summary>
    /// 用于从此处创建图形。
    /// </summary>
    public class ShapeFactory
    {
        /// <summary>
        /// 可以创建的类型，这里支持使用 FactoryType.PresetShape 或者使用 FactoryType.TextBox
        /// </summary>
        public static class FactoryType
        {
            public const string PresetShape = "PresetShape";
            public const string TextBox = "TextBox";
        }


        /// <summary>
        /// 指定类型和 id 进行可视化图形控件的创建。
        /// </summary>
        /// <param name="type">请在<see cref="FactoryType"/>中选择<see cref="FactoryType.TextBox"/>或者<see cref="FactoryType.PresetShape"/>填入。</param>
        /// <param name="id">图形的 id。</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Shape Create(string type, string id)
        {
            if (type == FactoryType.PresetShape)
                return new Shape()
                {
                    Id = id,
                    ShapeType = ShapeType.PresetShape
                };

            if (type == FactoryType.TextBox)
                return new Shape()
                {
                    Id = id,
                    ShapeType = ShapeType.Text
                };

            throw new NotImplementedException();
        }

        /// <summary>
        /// 指定类型和 id 进行可视化图形控件的创建。
        /// </summary>
        /// <param name="type">请在<see cref="FactoryType"/>中选择<see cref="FactoryType.TextBox"/>或者<see cref="FactoryType.PresetShape"/>填入。</param>
        /// <returns></returns>
        public Shape Create(string type)
        {
            return Create(type, RandomHelper.NewId());
        }
    }
}
